import java.io.*;
import java.util.ArrayList;
import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        class Solution {
            public int maxArea(int[] height) {
                int max=Integer.MIN_VALUE;
                int i=0;
                int j=height.length-1;
                while(i<j) {
                    int min=Math.min(height[i],height[j]);
                    int num=min*(j-i);
                    max=Math.max(num,max);
                    if(height[i]<height[j]) {
                        i++;
                    }else {
                        j--;
                    }
                }
                return max;
            }
        }
    }
}